const query = require("../db/query");

// 添加订单
const orderadd = (params) => {
  let sql = `INSERT INTO orderadmin (orderdoctor,orderuser,ordertime,orderprice) VALUES ('${params.doctor}','${params.user}','${params.time}','${params.price}')`;
  return query(sql);
};

// 查询订单
const orderlist = (params) => {
  let sql = `SELECT * FROM orderadmin a join doctorlist b join soco c on a.orderdoctor = b.doctorid and b.doctoradmin = c.socoid`;
  return query(sql);
};

// 查询详情
const orderdetail = (params) => {
  let sql = `SELECT * FROM orderadmin a join doctorlist b join soco c on a.orderdoctor = b.doctorid and b.doctoradmin = c.socoid WHERE orderid = ${params.id}`;
  return query(sql);
};

module.exports = {
  orderadd,
  orderlist,
  orderdetail,
};
